<?php
session_start();

include_once 'head.php';
include_once 'conf/conf.php';
include_once 'classes/AuthUser.class.php';
include_once 'classes/UserHandler.class.php';

$error = "";
$user = new AuthUser();

if (isset($_POST['ureg'])) {
  
    $userHandler = new UserHandler();
    
    try {
        $userHandler->registerUser($_POST, $_SESSION['snum']);
        $_SESSION['register_success'] = true;
        header("Location:index.php");
        exit();
    } catch (InputValidationException $e) {
        $error = $e->getMessage();
        $user = $e->getDataObject();
    }
}

include("regform.inc");        
